package br.unifor.mia.sd.proxy;

import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * <p>
 * This class contains all configuration regarding the Proxy tool.
 * </p>
 * 
 * @author Michel Vasconcelos
 *
 */
public class ProxyConfiguration {

	public static String DEFAULT_PORT = "default.port";
	
	private static ProxyConfiguration instance = null;
	
	Logger log = Logger.getLogger("br.unifor.mia.sd.proxy");
	
		
	private Properties conf = null;
	
	private ProxyConfiguration() {
		conf = new Properties();
		try {
			getClass().getClassLoader();
			conf.load(ClassLoader.getSystemResourceAsStream("proxy.properties"));
		} catch (IOException e) {
			if( log.isLoggable(Level.SEVERE)) {
				log.log(Level.SEVERE, "Could not load property file. ", e);
			}
		}
	}
	
	public static ProxyConfiguration getConfiguration() {
		if( instance == null) {
			instance = new ProxyConfiguration();
		}
		return instance;
	}
	
	public String getProperty(String propertyName) {
		return conf.getProperty(propertyName);
	}
	
}
